package com.itheima.day05_method;

public class Demo3_sum {
    public static void main(String[] args) {
        int s1 = sum(2);
        System.out.println("s1 = " + s1);

        int s2 = sum(3);
        System.out.println("s2 = " + s2);
    }
    public static int sum(int n){
        int sum = 0;
        for (int i = 0; i <= n; i++) {
            sum += i;
        }
        return sum;
    }
}
